package com.erdos.common.web.tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * ---------------------------------------------------------------------------------
 Confidential and Proprietary                                                                
 Copyright 2008 By                                                                                     
 SGAI & Hewlett-Packard Development Company, L.P. 	              
 All Rights Reserved                                                                                  

 Project Name : SGAI  MES                                                                                                                                       
 Class Name   : ReferenceTag.java    
 Package      : com.hp.common.web.tag                                                                   
 @version     $Id: ReferenceTag.java 9110 2012-03-08 02:08:48Z hubin $                                                          
 @author xiali2
 @since  2008-7-7 
 */
public class ReferenceTag extends BodyTagSupport {

	private static final long serialVersionUID = 2535434984147454403L;

	private static final Log logger = LogFactory.getLog(ReferenceTag.class);

	private String category;
	
	private String code;

	private String value;

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

    public int doStartTag () {
        return EVAL_BODY_BUFFERED;
    }

	public int doEndTag() throws JspException {
		logger.debug("invoke ReferenceTag doEndTag");
		JspWriter out = pageContext.getOut();
		try {
			out.println(this.getBodyContent().getString());
		} catch (IOException e) {
			logger.error("reference tag error", e);
		}
		return SKIP_BODY;
	}
}
